
Component({
  properties: {
    like:{
      type:Boolean,
      value:false,
     },
    count:{
      type:Number,
      readOnly:Boolean,
      value:0,
    }
  },
  data: {
      yesSrc:"../like/images/like.png",
      noSrc:"../like/images/onlike.png",
  },
  methods: {
    onLike(){
      var like=this.properties.like;
      var count=this.properties.count;
      if(like){
        this.setData({
          like:false,
          count:count-1
        })
      }else{
        this.setData({
          like:true,
          count:count+1
        })
      }
      var behavior=this.data.like
      this.triggerEvent('like',{
        behavior
      })
    }
  }
})
